﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DusonFramework.Caching
{
    public interface ICache
    {
        /// <summary>
        /// 添加数据到缓存中
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        /// <param name="value">缓存的对象</param>
        void Add(string key, object value);

        /// <summary>
        /// 添加数据到缓存中(关联指定文件组)
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        /// <param name="value">缓存的对象</param>
        /// <param name="files">监视的路径文件</param>
        void AddWithFilesDepend(string key, object value, params string[] files);

        /// <summary>
        /// 添加数据到缓存中(关联指定键值组)
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        /// <param name="value">缓存的对象</param>
        /// <param name="dependKey"></param>
        void AddWithCacheItemsDepend(string key, object value, params string[] dependKey);

        /// <summary>
        /// 移除缓存项
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        void Remove(string key);

        /// <summary>
        /// 判断缓存器中是否包含指定健值的缓存项
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        /// <returns>是/否</returns>
        bool Contains(string key);

        /// <summary>
        /// 获取缓存项
        /// </summary>
        /// <param name="key">缓存项的健值</param>
        /// <returns>缓存的对象，如果缓存中没有命中，则返回<c>null</c></returns>
        object Get(string key);

        /// <summary>
        /// 到期时间
        /// </summary>
        int TimeOut { set; get; }
    }
}
